package com.micro.user.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * <p>
 * </p>
 *
 * @author zcf
 * @since 2021/4/14
 */
@RestController
public class UserHalloController {

    @Resource
    private RestTemplate restTemplate;

    @Value("${user.name}")
    String userName;

    @Value("${user.age}")
    int age;

    @GetMapping("userName")
    public String userName(){
        return userName;
    }

    @GetMapping("age")
    public Integer age(){
        return age;
    }

    @GetMapping("hello")
    public String sayHello(){
        return "user ~~ hello";
    }


    @GetMapping("shop")
    public String sayUser(){
        return restTemplate.getForObject("http://shop/hello/", String.class);
    }


}
